Ext.namespace('Divo');
Ext.namespace('Divo.app');

Divo.app.WorkerForm = Ext.extend(Divo.Base.EditForm, {
      fields : new Ext.util.MixedCollection(),
      dataRecordMeta : Ext.data.Record.create([{
            name : "_p_record_status",
            type : "string"
          }, {
            name : "id",
            type : "float"
          }, {
            name : "name",
            type : "string"
          }]),
      initComponent : function() {
        var me = this;
        var tn = 1;

        this.fields.add("_p_record_status", new Ext.form.Hidden({
                  name : "_p_record_status"
                }));
        this.fields.add("id", new Ext.form.Hidden({
                  name : "id",
                  dataIndex : "id",
                  insert_allowed : true,
                  update_allowed : true
                }));
        this.fields.add("code", new app.base.TextField({
                  name : "code",
                  dataIndex : "code",
                  fieldLabel : "人员工号",
                  allowBlank : false,
                  labelSeparator : ":*",
                  tabIndex : tn++,
                  width : 150,
                  insert_allowed : true,
                  update_allowed : true
                }));
        this.fields.add("name", new app.base.TextField({
                  name : "name",
                  dataIndex : "name",
                  fieldLabel : "名称",
                  allowBlank : false,
                  labelSeparator : ":*",
                  tabIndex : tn++,
                  width : 150,
                  insert_allowed : true,
                  update_allowed : true
                }));
        this.fields.add("stateG", new Ext.form.RadioGroup({
                  name : "stateG",
                  dataIndex : "stateG",
                  fieldLabel : "状态",
                  allowBlank : false,
                  labelSeparator : ":*",
                  tabIndex : tn++,
                  width : 150,
                  defaultType : 'radio',
                  items : [{
                        fieldLabel : '',
                        boxLabel : '无效',
                        name : 'state',
                        inputValue : '1'
                      }, {
                        checked : true,
                        fieldLabel : '',
                        labelSeparator : '',
                        boxLabel : '有效',
                        name : 'state',
                        inputValue : '2'
                      }],
                  insert_allowed : true,
                  update_allowed : true
                }));
        Ext.apply(this, {
              items : [this.fields.get("_p_record_status"), {
                layout : "form",
                columnWidth : 1,
                labelAlign : "right",
                labelWidth : 100,
                items : [this.fields.get("id"), this.fields.get("code"),
                    this.fields.get("name")]
              }],
              border : false,
              frame : true,
              firstFocusFieldName : "code"
            });

        Divo.app.WorkerForm.superclass.initComponent.apply(this, arguments);
      }

      ,
      onRender : function() {
        Divo.app.WorkerForm.superclass.onRender.apply(this, arguments);
      },
      newDataRecord : function() {
        return new this.dataRecordMeta({
              _p_record_status : "insert",
              id : "",
              name : "",
              state : ""
            });
      }

    });
Ext.reg("Divo.app.WorkerForm", Divo.app.WorkerForm);